package com.ruoyi.carService.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.api.domain.OrderCount;
import com.ruoyi.system.api.domain.OrderCount;
import com.ruoyi.system.api.domain.OrderDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.carService.mapper.OrderDetailsMapper;
import com.ruoyi.system.api.domain.OrderDetails;
import com.ruoyi.carService.service.IOrderDetailsService;

/**
 * 洗车订单Service业务层处理
 * 订单统计Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-07
 */
@Service
public class OrderDetailsServiceImpl implements IOrderDetailsService 
{
    @Autowired
    private OrderDetailsMapper orderDetailsMapper;

    
    @Override
    public int getTodayOrderCount() {
        return orderDetailsMapper.getTodayOrderCount();
    }
    @Override
    public Long getTodayPayPriceSum() {
        return orderDetailsMapper.getTodayPayPriceSum();
    }
    
    /**
     * 查询洗车订单
     * 
     * @param orderDetailsId 洗车订单主键
     * @return 洗车订单
     */
    @Override
    public List<OrderCount> selectOrderCountList(String startTime,String endTime) {
        System.out.println(startTime+","+endTime);
        if (startTime!=null&&endTime!=null) {
            startTime = startTime+" 00:00:00";
            endTime = endTime+" 23:59:59";
        }
        return orderDetailsMapper.selectOrderCountList(startTime,endTime);
    }

    /**
     * 查询订单统计
     * 
     * @param orderDetailsId 订单统计主键
     * @return 订单统计
     */
    @Override
    public OrderDetails selectOrderDetailsByOrderDetailsId(Long orderDetailsId)
    {
        return orderDetailsMapper.selectOrderDetailsByOrderDetailsId(orderDetailsId);
    }

    /**
     * 查询洗车订单列表
     * 
     * @param orderDetails 洗车订单
     * @return 洗车订单
     */
    @Override
    public List<OrderDetails> selectOrderDetailsList(OrderDetails orderDetails)
    {
        return orderDetailsMapper.selectOrderDetailsList(orderDetails);
    }

    /**
     * 新增洗车订单
     * 
     * @param orderDetails 洗车订单
     * @return 结果
     */
    @Override
    public int insertOrderDetails(OrderDetails orderDetails)
    {
        orderDetails.setCreateTime(DateUtils.getNowDate());
        return orderDetailsMapper.insertOrderDetails(orderDetails);
    }

    /**
     * 修改洗车订单
     * 
     * @param orderDetails 洗车订单
     * @return 结果
     */
    @Override
    public int updateOrderDetails(OrderDetails orderDetails)
    {
        return orderDetailsMapper.updateOrderDetails(orderDetails);
    }

    /**
     * 批量删除洗车订单
     * 
     * @param orderDetailsIds 需要删除的洗车订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderDetailsByOrderDetailsIds(Long[] orderDetailsIds)
    {
        return orderDetailsMapper.deleteOrderDetailsByOrderDetailsIds(orderDetailsIds);
    }

    /**
     * 删除洗车订单信息
     * 
     * @param orderDetailsId 洗车订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderDetailsByOrderDetailsId(Long orderDetailsId)
    {
        return orderDetailsMapper.deleteOrderDetailsByOrderDetailsId(orderDetailsId);
    }
}
